<template>
  <h2>当前的求和为：{{ sum }}</h2>
  <button @click="sum++">点我+1</button>
</template>

<script>
import {ref} from "vue";

export default {
  name: "Demo",
  setup() {
    let sum = ref(0)

    return {
      sum,
    }
  },
  beforeCreate() {
    console.log('---beforeCreate---')
  },
  created() {
    console.log('---created---')
  },
  beforeMount() {
    console.log('---beforeMount---')
  },
  mounted() {
    console.log('---mounted---')
  },
  beforeUpdate() {
    console.log('---beforeUpdate---')
  },
  updated() {
    console.log('---updated---')
  },
  beforeDestroy() {
    console.log('---beforeDestroy---')
  },
  beforeUnmount() {
    console.log('---beforeUnmount---')
  },
  destroyed() {
    console.log('---destroyed---')
  },
  unmounted() {
    console.log('---unmounted---')
  }
}
</script>
